package logic

import (
	"context"
	"user_srv/internal/dao"
	"user_srv/internal/svc"
	"user_srv/user"

	"github.com/zeromicro/go-zero/core/logx"
)

type EquityIncreaseLogic struct {
	ctx    context.Context
	svcCtx *svc.ServiceContext
	logx.Logger
}

func NewEquityIncreaseLogic(ctx context.Context, svcCtx *svc.ServiceContext) *EquityIncreaseLogic {
	return &EquityIncreaseLogic{
		ctx:    ctx,
		svcCtx: svcCtx,
		Logger: logx.WithContext(ctx),
	}
}

func (l *EquityIncreaseLogic) EquityIncrease(in *user.EquityIncreaseRequest) (*user.EquityIncreaseResponse, error) {
	err := dao.EquityIncrease(int32(in.LevelId), in.Benefits)
	if err != nil {
		return nil, err
	}
	return &user.EquityIncreaseResponse{
		Msg: "增加权益成功",
	}, nil
}
